#include "DirectXCamera.h"

Camera::Camera (LPDIRECT3DDEVICE9 DrawDevice)
{
	Device = DrawDevice;
}

Camera::~Camera (void)
{
}

void Camera::SetCameraPosition (float Xpos, float Ypos, float Zpos,
								float Xat, float Yat, float Zat)
{
	D3DXMatrixLookAtLH (&View,
						&D3DXVECTOR3 (Xpos, Ypos, Zpos),
						&D3DXVECTOR3 (Xat, Yat, Zat),
						&D3DXVECTOR3 (0.0f, 1.0f, 0.0f));
	Device->SetTransform(D3DTS_VIEW, &View);
}

void Camera::SetCameraPerspective (float FOV, float Aspect, float Near, float Far)
{
	D3DXMatrixPerspectiveFovLH (&Projection, FOV, Aspect, Near, Far);
	Device->SetTransform(D3DTS_PROJECTION, &Projection);
}

void Camera::RotateCamera (float XVal, float YVal, float ZVal)
{
	D3DXMATRIX TempX, TempY, TempZ;
	D3DXMatrixRotationX(&TempX, XVal);
	D3DXMatrixRotationY(&TempY, YVal);
	D3DXMatrixRotationZ(&TempZ, ZVal);
	View *= (TempX * TempY * TempZ);
	Device->SetTransform(D3DTS_VIEW, &View);
}